#!/usr/local/bin/python3
# -*- coding: UTF-8 -*-
"""
@author:apple
@file:ClassMethod.py
@time:2021/09/16
"""


class Person:
    ...

    def __init__(self, name, age):
        self.name = name
        self.age = age

    @classmethod
    def instance(cls):
        return cls('zhangsan', 21)

    def __str__(self):
        return f'name:{self.name},age:{self.age}'


if __name__ == '__main__':
    per = Person.instance()
    print(per)
    print(hasattr(per, 'name'))
    setattr(per,'name','lisi')
    # delattr(per,'name')
    print(getattr(per, 'name'))
    print(per)

